<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <div>
        <label>姓名:</label>
        <input name="name" v-focus type="text"/>
    </div>
    <div>
        <label>年龄:</label>
        <input id="age" type="text"/>
    </div>
</div>
</body>
<script src="../../js/vue.js"></script>
<script type="text/javascript">
 Vue.directives('focus',{
     insertd(el){
         el.focus();
     }
 })
    var vm=new Vue({
        el:'#app',
        data(){
            return {}
        }
    })
</script>
</html>
